package com.ruoyi.web.controller.system;

import org.springframework.messaging.handler.annotation.MessageMapping;
import org.springframework.messaging.handler.annotation.SendTo;
import org.springframework.stereotype.Controller;

@Controller
public class ChatController {

    @MessageMapping("/sendMessage") // 处理来自客户端的消息
    @SendTo("/topic/messages") // 广播到该路径
    public String sendMessage(String message) {
        return message; // 将消息返回给订阅该路径的所有客户端
    }
}
